/**  
 * All rights Reserved, Designed By daiw
 * @Title:  MqController.java   
 * @Package org.component.integration.samples.mq   
 * @Description:    TODO (用一句话描述该文件做什么)   
 * @author: daiw     
 * @date:   2019年10月15日 下午4:39:20   
 * @Copyright: 2019 daiw Inc. All rights reserved. 
 */
package org.component.integration.samples.mq;

import java.util.Map;
import java.util.UUID;

import org.easyframework.activemq.EasyMqSender;
import org.easyframework.core.entity.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @ClassName: MqController
 * @Description: TODO (这里用一句话描述这个类的作用)
 * @author: daiw
 * @date: 2019年10月15日 下午4:39:20
 */
@Controller
@RequestMapping("mq")
public class MqController {

	@Autowired
	private EasyMqSender easyMqSender;

	@Value("${org_easy_mq_send}")
	private String queueTopic;

	@RequestMapping("send")
	@ResponseBody
	public ResponseResult send(@RequestBody Map<String, String> param) {
		String msg = UUID.randomUUID().toString();
		System.out.println("发送消息内容：" + msg);
		easyMqSender.send(queueTopic, msg);
		return ResponseResult.getSuccess(msg);
	}
}
